package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDTO;
import com.heima.model.admin.pojos.AdChannel;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "敏感词" ,tags = "敏感词")
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {

    @Autowired
    private AdSensitiveService adSensitiveService;

    /*
    * 分页查询
    * */
    @PostMapping("/list")
    @ApiOperation("敏感词列表")
    public PageResponseResult list(@RequestBody SensitiveDTO sensitiveDTO){
        return adSensitiveService.list(sensitiveDTO);
    }

    /*
    * 新增
    * */
    @PostMapping("/save")
    @ApiOperation("新增")
    public ResponseResult insert(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.insert(adSensitive);
    }

    /*
     * 新增
     * */
    @PostMapping("/update")
    @ApiOperation("编辑")
    public ResponseResult update(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.update(adSensitive);
    }

    /*
     * 删除
     * */
    @DeleteMapping("/del/{id}")
    @ApiOperation("删除")
    public ResponseResult delete(@PathVariable("id") Integer id){
        return adSensitiveService.delete(id);
    }



    @ApiOperation(value = "查询敏感词内容list")
    @PostMapping("/sensitives")
    public ResponseResult sensitives() {
        return adSensitiveService.selectAllSensitives();
    }
}
